/*
 * Copyright (c) 2013 XDream
 * Copyright (c) 2013 bruceshu <shuhuan.bruce@gmail.com>
 * 2024-8-7
 */


#ifndef FFMPEG_EXTRATOR_H
#define FFMPEG_EXTRATOR_H

#include <algorithm>

#ifdef __cplusplus
extern "C" {
#endif

#include "libavutil/dict.h"

#ifdef __cplusplus
}
#endif



#include "IExtractor.h"

using NotifyCallback = std::function<void()>;

class FfmpegExtractor : public IExtractor
{
private:
    AVFormatContext *mFormatCtx;
    std::atomic_bool interrupted;
    NotifyCallback mNotifyCallback;
    const int mId;

private:
    void notifyListener();

public:
    FfmpegExtractor(int id);
    ~FfmpegExtractor();
    int open();
    int seek();
    void close();
    int readPacket();
    void setInterrupt();
};




#endif